﻿Imports System.Text
Imports System
Public Class ImapClient_Event

    Private Sub btnAddEvent_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles btnAddEvent.Click
        ' add the selected message as an event for the current case
        'Dim strDate As String

        'If grdInbox.SelectedRows.Count = 0 Then
        '    MsgBox("Please select an email.")
        '    Exit Sub
        'End If
        'Dim strRecorSend As String = ""
        'Dim blnDocsAdded As Boolean
        'Dim strMessage As String
        '' load attachments to docstore
        'If rdoInbox.Checked = True Then
        '    strRecorSend = "Email Received"
        'Else
        '    strRecorSend = "Email Sent"
        'End If
        'Select Case Me.chkLoadAttachments.Checked
        '    Case True
        '        If Me.txtMessage.Text.Trim.ToString <> "" Then
        '            'If CType(Me.grdInbox.CurrentRow, Xceed.Grid.CellRow).Cells(3).Value() > 0 Then
        '            '    If MsgBox("This email has no message." & vbCrLf & "Would you like to continue adding attachments to the document store?", MsgBoxStyle.YesNo, "No Message") = MsgBoxResult.No Then
        '            '        Exit Sub
        '            '    End If
        '            'End If
        '            If CType(Me.grdInbox.CurrentRow, Xceed.Grid.CellRow).Cells(3).Value() > 0 Then
        '                Dim Msg As New StringBuilder
        '                Call GetMessageMAPIAttachments(CType(Me.grdInbox.CurrentRow, Xceed.Grid.CellRow).Cells(4).Value())
        '            End If
        '            blnDocsAdded = True
        '            'Me.Dispose()
        '            If Me.txtEventNote.Text.ToString <> "" Then
        '                strMessage = Me.txtEventNote.Text.ToString & vbCrLf & vbCrLf & "---------------------------------------------------------------" & vbCrLf & vbCrLf & Me.txtMessage.Text.ToString
        '            Else
        '                strMessage = Me.txtMessage.Text.ToString
        '            End If
        '            'strDate = GetEmailArrivalDate(CType(Me.grdInbox.CurrentRow, Xceed.Grid.CellRow).Cells(4).Value())
        '            TasksEvents.GblFunc_Add_Event(strRecorSend, strMessage, TasksEvents.EventStatus.SingleEvent, GlobalCRM.CurrentCaseID, CommonSQL.EventTypes.EventCase, , , , , , DateTime.Today)
        '            MsgBox("The email has been added as event and the documents are stored in Document Store.", MsgBoxStyle.OkOnly, "Success")
        '        ElseIf Me.txtMessage.Text.Trim.ToString = "" Then
        '            If CType(Me.grdInbox.CurrentRow, Xceed.Grid.CellRow).Cells(3).Value() > 0 Then
        '                If MsgBox("This email has no message." & vbCrLf & "Would you like to continue adding attachments to the document store?", MsgBoxStyle.YesNo, "No Message") = MsgBoxResult.No Then
        '                    Exit Sub
        '                Else
        '                    Call GetMessageMAPIAttachments(CType(Me.grdInbox.CurrentRow, Xceed.Grid.CellRow).Cells(4).Value())
        '                    blnDocsAdded = True
        '                    If Me.txtEventNote.Text.ToString <> "" Then
        '                        strMessage = Me.txtEventNote.Text.ToString & vbCrLf & vbCrLf & "---------------------------------------------------------------" & vbCrLf & vbCrLf & Me.txtMessage.Text.ToString
        '                    Else
        '                        strMessage = Me.txtMessage.Text.ToString
        '                    End If
        '                    'strDate = GetEmailArrivalDate(CType(Me.grdInbox.CurrentRow, Xceed.Grid.CellRow).Cells(4).Value())
        '                    TasksEvents.GblFunc_Add_Event(strRecorSend, strMessage, TasksEvents.EventStatus.SingleEvent, GlobalCRM.CurrentCaseID, CommonSQL.EventTypes.EventCase, , , , , , DateTime.Today)
        '                    MsgBox("The email has been added as event and the documents are stored in Document Store.", MsgBoxStyle.OkOnly, "Success")
        '                    Exit Sub
        '                End If
        '            Else
        '                MsgBox("This email has no message.", MsgBoxStyle.OkOnly, "No message")
        '            End If

        '            Exit Sub
        '        End If
        '    Case False
        '        If Me.txtEventNote.Text.ToString = "" Then
        '            'If blnDocsAdded Then
        '            If Me.txtMessage.Text.Trim.ToString = "" Then
        '                MsgBox("This email has no message.", MsgBoxStyle.OkOnly, "No message")
        '                Exit Sub

        '            End If
        '            'End If
        '            strMessage = Me.txtEventNote.Text.ToString & vbCrLf & vbCrLf & "---------------------------------------------------------------" & vbCrLf & vbCrLf & Me.txtMessage.Text.ToString
        '        Else
        '            strMessage = Me.txtMessage.Text.ToString
        '        End If
        '        'strDate = GetEmailArrivalDate(CType(Me.grdInbox.CurrentRow, Xceed.Grid.CellRow).Cells(4).Value())
        '        TasksEvents.GblFunc_Add_Event(strRecorSend, strMessage, TasksEvents.EventStatus.SingleEvent, GlobalCRM.CurrentCaseID, CommonSQL.EventTypes.EventCase, , , , , , DateTime.Today)
        '        MsgBox("The email has been added as event.", MsgBoxStyle.OkOnly, "Success")
        'End Select

        'If Me.chkKeepOpen.Checked = False Then
        '    Me.Dispose()
        'End If
    End Sub
End Class